package com.xyp.b_demo;

import java.util.concurrent.Executor;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * --- 加油，努力 ---
 *
 * @Author XYP
 * @Date 2024/8/5
 * @Desc 从想做到能做
 */
class MyThread implements Runnable {

    @Override
    public void run() {
        for (int i = 0; i < 5; i++) {
            System.out.println(Thread.currentThread().getName());
        }
    }
}



public class Demo1 {
    public static void main(String[] args) {

        ExecutorService pool1 = Executors.newCachedThreadPool();

        pool1.submit(new MyThread());
        pool1.submit(new MyThread());
        pool1.submit(new MyThread());
        pool1.submit(new MyThread());
        pool1.submit(new MyThread());
        pool1.submit(new MyThread());

        pool1.shutdown();

    }
}
